<style><?php $rand = rand(1000,9999);?>
.imageViewer .item {
	position: relative;
	float: left;
	border: dashed 1px rgb(184, 208, 214);
	padding: 2px;
	margin: 2px;
}

.imageViewer .item.upload {
	border: none;
}

.imageViewer .item img {
	width: auto;
	height: 116px;
	border: none;
}

.imageViewer .item .checkbox {
	position: absolute;
	bottom: 2px;
	right: 2px;
	float: left;
}
.imageViewer .item a.btnDel {bottom:5px; right:0; position:absolute;}
</style>
<div class="pageContent">
	<form method="post"
		action="<?php echo site_url('backend/product/images') ?>"
		class="pageForm required-validate"
		onsubmit="return validateCallback(this, navTabAjaxDone);">
		<div class="pageFormContent" layoutH="56">
			<input type="hidden" name="id" value="<?php echo $this->input->get('id')?>">
			<fieldset class="imageViewer">
				<legend>选择来自文章的图片</legend>
				<?php foreach ($data as $v):
					if($v['type'] == '2'):
				?>
				<div class="item">
					<a href="<?php echo base_url($v['img'])?>" data-target="fancybox" data-fancybox-group="fromContent" title="来自文章的图片"> <img
						src="<?php echo base_url($v['img'])?>"></a> <input type="checkbox"
							   class="checkbox" name="images[]" value="<?php echo $v['id']?>" />
				</div>
				<?php endif;endforeach;?>
			</fieldset>
			<fieldset class="imageViewer">
				<legend>添加商品展示</legend>
				<?php foreach ($data as $v):
					if($v['type'] == '1'):
				?>
				<div class="item">
					<a href="<?php echo base_url($v['img'])?>" data-target="fancybox" data-fancybox-group="productShow" title="商品展示"> <img
							src="<?php echo base_url($v['img'])?>"></a><a title="删除" target="ajaxTodo" callback="deleteProductLogo" href="<?php echo site_url('backend/Album/delete?ids=' . $v['id']); ?>" class="btnDel">删除</a>
				</div>
				<?php endif;endforeach;?>
				<div class="item upload">
					<input type="file" name="filedata" id="product_upload_<?php echo $rand?>">
					<script type="text/javascript">
						function deleteProductLogo (json) {
							DWZ.ajaxDone(json);
							if (json[DWZ.keys.statusCode] == DWZ.statusCode.ok){
								navTab.reload();
							}
						}
						$(function(){
							$("#product_upload_<?php echo $rand?>").uploadify({
								swf:'<?php echo base_url('data/share/uploadify/scripts/uploadify.swf')?>',
								uploader:'<?php echo site_url('backend/product/multiUpload?type=1')?>',
								formData:{PHPSESSID:'<?php echo session_id()?>',source_id:<?php echo $this->input->get('id')?>, type:1, ajax:1},
								buttonText:'请选择文件',
								fileTypeDesc:'*.jpg;*.jpeg;*.gif;*.png;',
								fileTypeExts:'*.jpg;*.jpeg;*.gif;*.png;',
								auto:true,
								multi:true,
								onUploadSuccess: function(file, data, response){
									var json = eval('('+data+')');
									if(json.statusCode === 200) {
										navTab.reload();
									}
								}
							});
						});
					</script>
				</div>
			</fieldset>
			<fieldset>
				<legend>批量处理</legend>
				<dl>
					<dt>宽度：</dt>
					<dd>
						<input type="text" name="width" placeholder="0表示不剪裁"
							class="required digits">
					</dd>
				</dl>
				<dl>
					<dt>高度：</dt>
					<dd>
						<input type="text" name="height" placeholder="0表示不剪裁"
							class="required digits">
					</dd>
				</dl>
				<dl>
					<dt>比例：</dt>
					<dd>
						<input type="checkbox" name="ratio" class="checkbox" checked="checked">
					</dd>
				</dl>
			</fieldset>
		</div>
		<div class="formBar">
			<ul>
				<!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
				<li><div class="buttonActive">
						<div class="buttonContent">
							<button type="submit">保存</button>
						</div>
					</div></li>
				<li>
					<div class="button">
						<div class="buttonContent">
							<button type="button" class="close">取消</button>
						</div>
					</div>
				</li>
			</ul>
		</div>
	</form>
</div>
<script src="<?php echo base_url('data/share/js/dwz.tooltip.js');?>"></script>